Micron Document
<!DOCTYPE html>
<html class="client-nojs vector-feature-night-mode-disabled vector-feature-language-in-header-enabled vector-feature-language-in-main-page-header-disabled vector-feature-page-tools-pinned-disabled vector-feature-toc-pinned-clientpref-1 vector-feature-main-menu-pinned-disabled vector-feature-limited-width-clientpref-1 vector-feature-limited-width-content-enabled vector-feature-custom-font-size-clientpref-1 vector-feature-appearance-pinned-clientpref-1 vector-sticky-header-enabled" lang="en" dir="ltr"><head>
<meta charset="UTF-8">
<title>Lentz's algorithm</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="canonical" href="https://en.wikipedia.org/wiki/Lentz's_algorithm"> <link href="./mw/ext.cite.styles.css" rel="stylesheet" type="text/css">
<link href="./mw/ext.math.styles.css" rel="stylesheet" type="text/css">
<link href="./mw/skins.vector.icons.css" rel="stylesheet" type="text/css">
<link href="./mw/skins.vector.search.codex.styles.css" rel="stylesheet" type="text/css">
<link href="./mw/skins.vector.styles.css" rel="stylesheet" type="text/css">
<link href="./mw/user.styles.css" rel="stylesheet" type="text/css">
<meta name="ResourceLoaderDynamicStyles" content="">
<link rel="stylesheet" type="text/css" href="./mw/site.styles.css">
<link rel="stylesheet" type="text/css" href="./mw/noscript.css">
<link rel="stylesheet" type="text/css" href="./footer.css">
<link rel="stylesheet" type="text/css" href="./vector-2022.css">
</head>
<body class="skin--responsive skin-vector skin-vector-search-vue mediawiki ltr sitedir-ltr mw-hide-empty-elt ns-0 ns-subject page-Lentz_s_algorithm rootpage-Lentz_s_algorithm skin-vector-2022 action-view">
<div class="mw-page-container">
<div class="mw-page-container-inner">
<div class="mw-content-container">
<main id="content" class="mw-body">
<header class="mw-body-header vector-page-titlebar">
<h1 id="firstHeading" class="firstHeading mw-first-heading">
<span id="openzim-page-title" class="mw-page-title-main"><span class="mw-page-title-main">Lentz's algorithm</span></span>
</h1>
</header>
<a id="top"></a>
<div id="bodyContent" class="vector-body ve-init-mw-desktopArticleTarget-targetContainer" aria-labelledby="firstHeading" data-mw-ve-target-container="">
<div id="mw-content-text" class="mw-body-content mw-content-ltr" lang="en" dir="ltr"><div class="mw-content-ltr mw-parser-output" lang="en" dir="ltr"><p>In mathematics, <b>Lentz's algorithm</b> is an <a href="Algorithm" title="Algorithm">algorithm</a> to evaluate <a href="Generalized_continued_fraction" class="mw-redirect" title="Generalized continued fraction">continued fractions</a>, and was originally devised to compute tables of spherical <a href="Bessel_function" title="Bessel function">Bessel functions</a>.<sup id="cite_ref-:0_1-0" class="reference"><a href="#cite_note-:0-1"><span class="cite-bracket">[</span>1<span class="cite-bracket">]</span></a></sup><sup id="cite_ref-numerical-recipes-c++_2-0" class="reference"><a href="#cite_note-numerical-recipes-c++-2"><span class="cite-bracket">[</span>2<span class="cite-bracket">]</span></a></sup>
</p><p>The version usually employed now is due to Thompson and Barnett.<sup id="cite_ref-Thompson-and-Barnett_3-0" class="reference"><a href="#cite_note-Thompson-and-Barnett-3"><span class="cite-bracket">[</span>3<span class="cite-bracket">]</span></a></sup>
</p>
<meta property="mw:PageProp/toc">
<div class="mw-heading mw-heading2"><h2 id="History">History</h2></div>
<p>The idea was introduced in 1973 by William J. Lentz<sup id="cite_ref-:0_1-1" class="reference"><a href="#cite_note-:0-1"><span class="cite-bracket">[</span>1<span class="cite-bracket">]</span></a></sup> and was simplified by him in 1982.<sup id="cite_ref-4" class="reference"><a href="#cite_note-4"><span class="cite-bracket">[</span>4<span class="cite-bracket">]</span></a></sup> Lentz suggested that calculating ratios of spherical Bessel functions of complex arguments can be difficult. He developed a new continued fraction technique for calculating the ratios of spherical Bessel functions of consecutive order. This method was an improvement compared to other methods because it started from the beginning of the continued fraction rather than the tail, had a built-in check for convergence, and was numerically stable. The original algorithm uses algebra to bypass a zero in either the numerator or denominator.<sup id="cite_ref-Lentz_668–671_5-0" class="reference"><a href="#cite_note-Lentz_668–671-5"><span class="cite-bracket">[</span>5<span class="cite-bracket">]</span></a></sup> Simpler Improvements to overcome unwanted zero terms include an altered recurrence relation<sup id="cite_ref-6" class="reference"><a href="#cite_note-6"><span class="cite-bracket">[</span>6<span class="cite-bracket">]</span></a></sup> suggested by Jaaskelainen and Ruuskanen in 1981 or a simple shift of the denominator by a very small number as suggested by Thompson and Barnett in 1986.<sup id="cite_ref-Thompson-and-Barnett_3-1" class="reference"><a href="#cite_note-Thompson-and-Barnett-3"><span class="cite-bracket">[</span>3<span class="cite-bracket">]</span></a></sup>
</p>
<div class="mw-heading mw-heading2"><h2 id="Initial_work">Initial work</h2></div>
<p>This theory was initially motivated by Lentz's need for accurate calculation of ratios of spherical Bessel function necessary for <a href="Mie_scattering" title="Mie scattering">Mie scattering</a>. He created a new continued fraction algorithm that starts from the beginning of the continued fraction and not at the tail-end. This eliminates guessing how many terms of the continued fraction are needed for convergence. In addition, continued fraction representations for both ratios of Bessel functions and spherical Bessel functions of consecutive order themselves can be computed with Lentz's algorithm.<sup id="cite_ref-Lentz_668–671_5-1" class="reference"><a href="#cite_note-Lentz_668–671-5"><span class="cite-bracket">[</span>5<span class="cite-bracket">]</span></a></sup> The algorithm suggested that it is possible to terminate the evaluation of continued fractions when <span class="mwe-math-element mwe-math-element-inline"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle |f_{j}-f_{j-1}|}">
<semantics>
<mrow class="MJX-TeXAtom-ORD">
<mstyle displaystyle="true" scriptlevel="0">
<mrow class="MJX-TeXAtom-ORD">
<mo stretchy="false">|</mo>
</mrow>
<msub>
<mi>f</mi>
<mrow class="MJX-TeXAtom-ORD">
<mi>j</mi>
</mrow>
</msub>
<mo>−<!-- − --></mo>
<msub>
<mi>f</mi>
<mrow class="MJX-TeXAtom-ORD">
<mi>j</mi>
<mo>−<!-- − --></mo>
<mn>1</mn>
</mrow>
</msub>
<mrow class="MJX-TeXAtom-ORD">
<mo stretchy="false">|</mo>
</mrow>
</mstyle>
</mrow>
<annotation encoding="application/x-tex">{\displaystyle |f_{j}-f_{j-1}|}</annotation>
</semantics>
</math></span><img src="./15a5e6904e89a603cf69359221d4badcc9a9e6f6.svg" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -1.005ex; width:10.332ex; height:3.009ex;" alt="{\displaystyle |f_{j}-f_{j-1}|}" loading="lazy"></span> is relatively small.<sup id="cite_ref-7" class="reference"><a href="#cite_note-7"><span class="cite-bracket">[</span>7<span class="cite-bracket">]</span></a></sup>
</p>
<div class="mw-heading mw-heading2"><h2 id="Algorithm">Algorithm</h2></div>
<p>Lentz's algorithm is based on the <a href="Wallis-Euler_relations" class="mw-redirect" title="Wallis-Euler relations">Wallis-Euler relations</a>. If
</p>
<dl><dd><span class="mwe-math-element mwe-math-element-inline"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle {f}_{0}={b}_{0}}">
<semantics>
<mrow class="MJX-TeXAtom-ORD">
<mstyle displaystyle="true" scriptlevel="0">
<msub>
<mrow class="MJX-TeXAtom-ORD">
<mi>f</mi>
</mrow>
<mrow class="MJX-TeXAtom-ORD">
<mn>0</mn>
</mrow>
</msub>
<mo>=</mo>
<msub>
<mrow class="MJX-TeXAtom-ORD">
<mi>b</mi>
</mrow>
<mrow class="MJX-TeXAtom-ORD">
<mn>0</mn>
</mrow>
</msub>
</mstyle>
</mrow>
<annotation encoding="application/x-tex">{\displaystyle {f}_{0}={b}_{0}}</annotation>
</semantics>
</math></span><img src="./e05f94f73c21b2fb61884517224e46c97bce5e42.svg" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.838ex; width:7.344ex; height:2.676ex;" alt="{\displaystyle {f}_{0}={b}_{0}}" loading="lazy"></span></dd></dl>
<dl><dd><span class="mwe-math-element mwe-math-element-inline"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle {f}_{1}={b}_{0}+{\frac {{a}_{1}}{{b}_{1}}}}">
<semantics>
<mrow class="MJX-TeXAtom-ORD">
<mstyle displaystyle="true" scriptlevel="0">
<msub>
<mrow class="MJX-TeXAtom-ORD">
<mi>f</mi>
</mrow>
<mrow class="MJX-TeXAtom-ORD">
<mn>1</mn>
</mrow>
</msub>
<mo>=</mo>
<msub>
<mrow class="MJX-TeXAtom-ORD">
<mi>b</mi>
</mrow>
<mrow class="MJX-TeXAtom-ORD">
<mn>0</mn>
</mrow>
</msub>
<mo>+</mo>
<mrow class="MJX-TeXAtom-ORD">
<mfrac>
<msub>
<mrow class="MJX-TeXAtom-ORD">
<mi>a</mi>
</mrow>
<mrow class="MJX-TeXAtom-ORD">
<mn>1</mn>
</mrow>
</msub>
<msub>
<mrow class="MJX-TeXAtom-ORD">
<mi>b</mi>
</mrow>
<mrow class="MJX-TeXAtom-ORD">
<mn>1</mn>
</mrow>
</msub>
</mfrac>
</mrow>
</mstyle>
</mrow>
<annotation encoding="application/x-tex">{\displaystyle {f}_{1}={b}_{0}+{\frac {{a}_{1}}{{b}_{1}}}}</annotation>
</semantics>
</math></span><img src="./dbf518b4d0eed29ab67b6055c632d2e7d1fa144d.svg" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -2.338ex; width:13.304ex; height:5.176ex;" alt="{\displaystyle {f}_{1}={b}_{0}+{\frac {{a}_{1}}{{b}_{1}}}}" loading="lazy"></span></dd></dl>
<dl><dd><span class="mwe-math-element mwe-math-element-inline"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle {f}_{2}={b}_{0}+{\frac {{a}_{1}}{{b}_{1}+{\frac {{a}_{2}}{{b}_{2}}}}}}">
<semantics>
<mrow class="MJX-TeXAtom-ORD">
<mstyle displaystyle="true" scriptlevel="0">
<msub>
<mrow class="MJX-TeXAtom-ORD">
<mi>f</mi>
</mrow>
<mrow class="MJX-TeXAtom-ORD">
<mn>2</mn>
</mrow>
</msub>
<mo>=</mo>
<msub>
<mrow class="MJX-TeXAtom-ORD">
<mi>b</mi>
</mrow>
<mrow class="MJX-TeXAtom-ORD">
<mn>0</mn>
</mrow>
</msub>
<mo>+</mo>
<mrow class="MJX-TeXAtom-ORD">
<mfrac>
<msub>
<mrow class="MJX-TeXAtom-ORD">
<mi>a</mi>
</mrow>
<mrow class="MJX-TeXAtom-ORD">
<mn>1</mn>
</mrow>
</msub>
<mrow>
<msub>
<mrow class="MJX-TeXAtom-ORD">
<mi>b</mi>
</mrow>
<mrow class="MJX-TeXAtom-ORD">
<mn>1</mn>
</mrow>
</msub>
<mo>+</mo>
<mrow class="MJX-TeXAtom-ORD">
<mfrac>
<msub>
<mrow class="MJX-TeXAtom-ORD">
<mi>a</mi>
</mrow>
<mrow class="MJX-TeXAtom-ORD">
<mn>2</mn>
</mrow>
</msub>
<msub>
<mrow class="MJX-TeXAtom-ORD">
<mi>b</mi>
</mrow>
<mrow class="MJX-TeXAtom-ORD">
<mn>2</mn>
</mrow>
</msub>
</mfrac>
</mrow>
</mrow>
</mfrac>
</mrow>
</mstyle>
</mrow>
<annotation encoding="application/x-tex">{\displaystyle {f}_{2}={b}_{0}+{\frac {{a}_{1}}{{b}_{1}+{\frac {{a}_{2}}{{b}_{2}}}}}}</annotation>
</semantics>
</math></span><img src="./5f241cce72a37649a42d753f62c9ba3fb7df450d.svg" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -3.671ex; width:18.45ex; height:6.509ex;" alt="{\displaystyle {f}_{2}={b}_{0}+{\frac {{a}_{1}}{{b}_{1}+{\frac {{a}_{2}}{{b}_{2}}}}}}" loading="lazy"></span></dd></dl>
<dl><dd><span class="mwe-math-element mwe-math-element-inline"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle {f}_{3}={b}_{0}+{\frac {{a}_{1}}{{b}_{1}+{\frac {{a}_{2}}{{b}_{2}+{\frac {{a}_{3}}{{b}_{3}}}}}}}}">
<semantics>
<mrow class="MJX-TeXAtom-ORD">
<mstyle displaystyle="true" scriptlevel="0">
<msub>
<mrow class="MJX-TeXAtom-ORD">
<mi>f</mi>
</mrow>
<mrow class="MJX-TeXAtom-ORD">
<mn>3</mn>
</mrow>
</msub>
<mo>=</mo>
<msub>
<mrow class="MJX-TeXAtom-ORD">
<mi>b</mi>
</mrow>
<mrow class="MJX-TeXAtom-ORD">
<mn>0</mn>
</mrow>
</msub>
<mo>+</mo>
<mrow class="MJX-TeXAtom-ORD">
<mfrac>
<msub>
<mrow class="MJX-TeXAtom-ORD">
<mi>a</mi>
</mrow>
<mrow class="MJX-TeXAtom-ORD">
<mn>1</mn>
</mrow>
</msub>
<mrow>
<msub>
<mrow class="MJX-TeXAtom-ORD">
<mi>b</mi>
</mrow>
<mrow class="MJX-TeXAtom-ORD">
<mn>1</mn>
</mrow>
</msub>
<mo>+</mo>
<mrow class="MJX-TeXAtom-ORD">
<mfrac>
<msub>
<mrow class="MJX-TeXAtom-ORD">
<mi>a</mi>
</mrow>
<mrow class="MJX-TeXAtom-ORD">
<mn>2</mn>
</mrow>
</msub>
<mrow>
<msub>
<mrow class="MJX-TeXAtom-ORD">
<mi>b</mi>
</mrow>
<mrow class="MJX-TeXAtom-ORD">
<mn>2</mn>
</mrow>
</msub>
<mo>+</mo>
<mrow class="MJX-TeXAtom-ORD">
<mfrac>
<msub>
<mrow class="MJX-TeXAtom-ORD">
<mi>a</mi>
</mrow>
<mrow class="MJX-TeXAtom-ORD">
<mn>3</mn>
</mrow>
</msub>
<msub>
<mrow class="MJX-TeXAtom-ORD">
<mi>b</mi>
</mrow>
<mrow class="MJX-TeXAtom-ORD">
<mn>3</mn>
</mrow>
</msub>
</mfrac>
</mrow>
</mrow>
</mfrac>
</mrow>
</mrow>
</mfrac>
</mrow>
</mstyle>
</mrow>
<annotation encoding="application/x-tex">{\displaystyle {f}_{3}={b}_{0}+{\frac {{a}_{1}}{{b}_{1}+{\frac {{a}_{2}}{{b}_{2}+{\frac {{a}_{3}}{{b}_{3}}}}}}}}</annotation>
</semantics>
</math></span><img src="./cd7ecc75a5248639285a62ea5396c24bce06a221.svg" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -5.671ex; width:21.907ex; height:8.509ex;" alt="{\displaystyle {f}_{3}={b}_{0}+{\frac {{a}_{1}}{{b}_{1}+{\frac {{a}_{2}}{{b}_{2}+{\frac {{a}_{3}}{{b}_{3}}}}}}}}" loading="lazy"></span></dd></dl>
<p>etc., or using the <a href="Generalized_continued_fraction" class="mw-redirect" title="Generalized continued fraction">big-K notation</a>, if
</p>
<dl><dd><span class="mwe-math-element mwe-math-element-inline"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle {f}_{n}={b}_{0}+{\underset {j=1}{\overset {n}{\operatorname {K} }}}{\frac {{a}_{j}}{{b}_{j}}}}">
<semantics>
<mrow class="MJX-TeXAtom-ORD">
<mstyle displaystyle="true" scriptlevel="0">
<msub>
<mrow class="MJX-TeXAtom-ORD">
<mi>f</mi>
</mrow>
<mrow class="MJX-TeXAtom-ORD">
<mi>n</mi>
</mrow>
</msub>
<mo>=</mo>
<msub>
<mrow class="MJX-TeXAtom-ORD">
<mi>b</mi>
</mrow>
<mrow class="MJX-TeXAtom-ORD">
<mn>0</mn>
</mrow>
</msub>
<mo>+</mo>
<mrow class="MJX-TeXAtom-ORD">
<munder>
<mover>
<mi mathvariant="normal">K</mi>
<mi>n</mi>
</mover>
<mrow>
<mi>j</mi>
<mo>=</mo>
<mn>1</mn>
</mrow>
</munder>
</mrow>
<mrow class="MJX-TeXAtom-ORD">
<mfrac>
<msub>
<mrow class="MJX-TeXAtom-ORD">
<mi>a</mi>
</mrow>
<mrow class="MJX-TeXAtom-ORD">
<mi>j</mi>
</mrow>
</msub>
<msub>
<mrow class="MJX-TeXAtom-ORD">
<mi>b</mi>
</mrow>
<mrow class="MJX-TeXAtom-ORD">
<mi>j</mi>
</mrow>
</msub>
</mfrac>
</mrow>
</mstyle>
</mrow>
<annotation encoding="application/x-tex">{\displaystyle {f}_{n}={b}_{0}+{\underset {j=1}{\overset {n}{\operatorname {K} }}}{\frac {{a}_{j}}{{b}_{j}}}}</annotation>
</semantics>
</math></span><img src="./8e0ff3e70d1587eb3b99c81c605094fd02c1aab7.svg" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -2.671ex; width:16.102ex; height:6.009ex;" alt="{\displaystyle {f}_{n}={b}_{0}+{\underset {j=1}{\overset {n}{\operatorname {K} }}}{\frac {{a}_{j}}{{b}_{j}}}}" loading="lazy"></span></dd></dl>
<p>is the <span class="mwe-math-element mwe-math-element-inline"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle n}">
<semantics>
<mrow class="MJX-TeXAtom-ORD">
<mstyle displaystyle="true" scriptlevel="0">
<mi>n</mi>
</mstyle>
</mrow>
<annotation encoding="application/x-tex">{\displaystyle n}</annotation>
</semantics>
</math></span><img src="./a601995d55609f2d9f5e233e36fbe9ea26011b3b.svg" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.338ex; width:1.395ex; height:1.676ex;" alt="{\displaystyle n}" loading="lazy"></span>th convergent to <span class="mwe-math-element mwe-math-element-inline"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle f}">
<semantics>
<mrow class="MJX-TeXAtom-ORD">
<mstyle displaystyle="true" scriptlevel="0">
<mi>f</mi>
</mstyle>
</mrow>
<annotation encoding="application/x-tex">{\displaystyle f}</annotation>
</semantics>
</math></span><img src="./132e57acb643253e7810ee9702d9581f159a1c61.svg" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.671ex; width:1.279ex; height:2.509ex;" alt="{\displaystyle f}" loading="lazy"></span> then
</p>
<dl><dd><span class="mwe-math-element mwe-math-element-inline"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle {f}_{n}={\frac {{A}_{n}}{{B}_{n}}}}">
<semantics>
<mrow class="MJX-TeXAtom-ORD">
<mstyle displaystyle="true" scriptlevel="0">
<msub>
<mrow class="MJX-TeXAtom-ORD">
<mi>f</mi>
</mrow>
<mrow class="MJX-TeXAtom-ORD">
<mi>n</mi>
</mrow>
</msub>
<mo>=</mo>
<mrow class="MJX-TeXAtom-ORD">
<mfrac>
<msub>
<mrow class="MJX-TeXAtom-ORD">
<mi>A</mi>
</mrow>
<mrow class="MJX-TeXAtom-ORD">
<mi>n</mi>
</mrow>
</msub>
<msub>
<mrow class="MJX-TeXAtom-ORD">
<mi>B</mi>
</mrow>
<mrow class="MJX-TeXAtom-ORD">
<mi>n</mi>
</mrow>
</msub>
</mfrac>
</mrow>
</mstyle>
</mrow>
<annotation encoding="application/x-tex">{\displaystyle {f}_{n}={\frac {{A}_{n}}{{B}_{n}}}}</annotation>
</semantics>
</math></span><img src="./3822f0e9f77eb3f82465f116b767fdcbd4804389.svg" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -2.338ex; width:9.275ex; height:5.843ex;" alt="{\displaystyle {f}_{n}={\frac {{A}_{n}}{{B}_{n}}}}" loading="lazy"></span></dd></dl>
<p>where <span class="mwe-math-element mwe-math-element-inline"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle {A}_{n}}">
<semantics>
<mrow class="MJX-TeXAtom-ORD">
<mstyle displaystyle="true" scriptlevel="0">
<msub>
<mrow class="MJX-TeXAtom-ORD">
<mi>A</mi>
</mrow>
<mrow class="MJX-TeXAtom-ORD">
<mi>n</mi>
</mrow>
</msub>
</mstyle>
</mrow>
<annotation encoding="application/x-tex">{\displaystyle {A}_{n}}</annotation>
</semantics>
</math></span><img src="./f8e79bb17c03f6c7a65c8c5f94b806278dc427b3.svg" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.671ex; width:2.962ex; height:2.509ex;" alt="{\displaystyle {A}_{n}}" loading="lazy"></span> and <span class="mwe-math-element mwe-math-element-inline"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle {B}_{n}}">
<semantics>
<mrow class="MJX-TeXAtom-ORD">
<mstyle displaystyle="true" scriptlevel="0">
<msub>
<mrow class="MJX-TeXAtom-ORD">
<mi>B</mi>
</mrow>
<mrow class="MJX-TeXAtom-ORD">
<mi>n</mi>
</mrow>
</msub>
</mstyle>
</mrow>
<annotation encoding="application/x-tex">{\displaystyle {B}_{n}}</annotation>
</semantics>
</math></span><img src="./289124e7c837841043aa0a314986f148f4bcb517.svg" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.671ex; width:2.982ex; height:2.509ex;" alt="{\displaystyle {B}_{n}}" loading="lazy"></span> are given by the Wallis-Euler recurrence relations
</p>
<dl><dd><span class="mwe-math-element mwe-math-element-inline"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle {\begin{aligned}{A}_{-1}&amp;=1&amp;{B}_{-1}&amp;=0\\{A}_{0}&amp;={b}_{0}&amp;{B}_{0}&amp;=1\\{A}_{n}&amp;={b}_{n}{A}_{n-1}+{a}_{n}{A}_{n-2}&amp;{B}_{n}&amp;={b}_{n}{B}_{n-1}+{a}_{n}{B}_{n-2}\end{aligned}}}">
<semantics>
<mrow class="MJX-TeXAtom-ORD">
<mstyle displaystyle="true" scriptlevel="0">
<mrow class="MJX-TeXAtom-ORD">
<mtable columnalign="right left right left right left right left right left right left" rowspacing="3pt" columnspacing="0em 2em 0em 2em 0em 2em 0em 2em 0em 2em 0em" displaystyle="true">
<mtr>
<mtd>
<msub>
<mrow class="MJX-TeXAtom-ORD">
<mi>A</mi>
</mrow>
<mrow class="MJX-TeXAtom-ORD">
<mo>−<!-- − --></mo>
<mn>1</mn>
</mrow>
</msub>
</mtd>
<mtd>
<mi></mi>
<mo>=</mo>
<mn>1</mn>
</mtd>
<mtd>
<msub>
<mrow class="MJX-TeXAtom-ORD">
<mi>B</mi>
</mrow>
<mrow class="MJX-TeXAtom-ORD">
<mo>−<!-- − --></mo>
<mn>1</mn>
</mrow>
</msub>
</mtd>
<mtd>
<mi></mi>
<mo>=</mo>
<mn>0</mn>
</mtd>
</mtr>
<mtr>
<mtd>
<msub>
<mrow class="MJX-TeXAtom-ORD">
<mi>A</mi>
</mrow>
<mrow class="MJX-TeXAtom-ORD">
<mn>0</mn>
</mrow>
</msub>
</mtd>
<mtd>
<mi></mi>
<mo>=</mo>
<msub>
<mrow class="MJX-TeXAtom-ORD">
<mi>b</mi>
</mrow>
<mrow class="MJX-TeXAtom-ORD">
<mn>0</mn>
</mrow>
</msub>
</mtd>
<mtd>
<msub>
<mrow class="MJX-TeXAtom-ORD">
<mi>B</mi>
</mrow>
<mrow class="MJX-TeXAtom-ORD">
<mn>0</mn>
</mrow>
</msub>
</mtd>
<mtd>
<mi></mi>
<mo>=</mo>
<mn>1</mn>
</mtd>
</mtr>
<mtr>
<mtd>
<msub>
<mrow class="MJX-TeXAtom-ORD">
<mi>A</mi>
</mrow>
<mrow class="MJX-TeXAtom-ORD">
<mi>n</mi>
</mrow>
</msub>
</mtd>
<mtd>
<mi></mi>
<mo>=</mo>
<msub>
<mrow class="MJX-TeXAtom-ORD">
<mi>b</mi>
</mrow>
<mrow class="MJX-TeXAtom-ORD">
<mi>n</mi>
</mrow>
</msub>
<msub>
<mrow class="MJX-TeXAtom-ORD">
<mi>A</mi>
</mrow>
<mrow class="MJX-TeXAtom-ORD">
<mi>n</mi>
<mo>−<!-- − --></mo>
<mn>1</mn>
</mrow>
</msub>
<mo>+</mo>
<msub>
<mrow class="MJX-TeXAtom-ORD">
<mi>a</mi>
</mrow>
<mrow class="MJX-TeXAtom-ORD">
<mi>n</mi>
</mrow>
</msub>
<msub>
<mrow class="MJX-TeXAtom-ORD">
<mi>A</mi>
</mrow>
<mrow class="MJX-TeXAtom-ORD">
<mi>n</mi>
<mo>−<!-- − --></mo>
<mn>2</mn>
</mrow>
</msub>
</mtd>
<mtd>
<msub>
<mrow class="MJX-TeXAtom-ORD">
<mi>B</mi>
</mrow>
<mrow class="MJX-TeXAtom-ORD">
<mi>n</mi>
</mrow>
</msub>
</mtd>
<mtd>
<mi></mi>
<mo>=</mo>
<msub>
<mrow class="MJX-TeXAtom-ORD">
<mi>b</mi>
</mrow>
<mrow class="MJX-TeXAtom-ORD">
<mi>n</mi>
</mrow>
</msub>
<msub>
<mrow class="MJX-TeXAtom-ORD">
<mi>B</mi>
</mrow>
<mrow class="MJX-TeXAtom-ORD">
<mi>n</mi>
<mo>−<!-- − --></mo>
<mn>1</mn>
</mrow>
</msub>
<mo>+</mo>
<msub>
<mrow class="MJX-TeXAtom-ORD">
<mi>a</mi>
</mrow>
<mrow class="MJX-TeXAtom-ORD">
<mi>n</mi>
</mrow>
</msub>
<msub>
<mrow class="MJX-TeXAtom-ORD">
<mi>B</mi>
</mrow>
<mrow class="MJX-TeXAtom-ORD">
<mi>n</mi>
<mo>−<!-- − --></mo>
<mn>2</mn>
</mrow>
</msub>
</mtd>
</mtr>
</mtable>
</mrow>
</mstyle>
</mrow>
<annotation encoding="application/x-tex">{\displaystyle {\begin{aligned}{A}_{-1}&amp;=1&amp;{B}_{-1}&amp;=0\\{A}_{0}&amp;={b}_{0}&amp;{B}_{0}&amp;=1\\{A}_{n}&amp;={b}_{n}{A}_{n-1}+{a}_{n}{A}_{n-2}&amp;{B}_{n}&amp;={b}_{n}{B}_{n-1}+{a}_{n}{B}_{n-2}\end{aligned}}}</annotation>
</semantics>
</math></span><img src="./675f5c69362dc2b6b32cd9fced70f7f052988b2d.svg" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -3.838ex; width:55.066ex; height:8.843ex;" alt="{\displaystyle {\begin{aligned}{A}_{-1}&amp;=1&amp;{B}_{-1}&amp;=0\\{A}_{0}&amp;={b}_{0}&amp;{B}_{0}&amp;=1\\{A}_{n}&amp;={b}_{n}{A}_{n-1}+{a}_{n}{A}_{n-2}&amp;{B}_{n}&amp;={b}_{n}{B}_{n-1}+{a}_{n}{B}_{n-2}\end{aligned}}}" loading="lazy"></span></dd></dl>
<p>Lentz's method defines
</p>
<dl><dd><span class="mwe-math-element mwe-math-element-inline"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle {C}_{n}={\frac {{A}_{n}}{{A}_{n-1}}}}">
<semantics>
<mrow class="MJX-TeXAtom-ORD">
<mstyle displaystyle="true" scriptlevel="0">
<msub>
<mrow class="MJX-TeXAtom-ORD">
<mi>C</mi>
</mrow>
<mrow class="MJX-TeXAtom-ORD">
<mi>n</mi>
</mrow>
</msub>
<mo>=</mo>
<mrow class="MJX-TeXAtom-ORD">
<mfrac>
<msub>
<mrow class="MJX-TeXAtom-ORD">
<mi>A</mi>
</mrow>
<mrow class="MJX-TeXAtom-ORD">
<mi>n</mi>
</mrow>
</msub>
<msub>
<mrow class="MJX-TeXAtom-ORD">
<mi>A</mi>
</mrow>
<mrow class="MJX-TeXAtom-ORD">
<mi>n</mi>
<mo>−<!-- − --></mo>
<mn>1</mn>
</mrow>
</msub>
</mfrac>
</mrow>
</mstyle>
</mrow>
<annotation encoding="application/x-tex">{\displaystyle {C}_{n}={\frac {{A}_{n}}{{A}_{n-1}}}}</annotation>
</semantics>
</math></span><img src="./fbee79339399549d05b5d80951d457a34bc91983.svg" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -2.505ex; width:11.877ex; height:6.009ex;" alt="{\displaystyle {C}_{n}={\frac {{A}_{n}}{{A}_{n-1}}}}" loading="lazy"></span></dd></dl>
<dl><dd><span class="mwe-math-element mwe-math-element-inline"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle {D}_{n}={\frac {{B}_{n-1}}{{B}_{n}}}}">
<semantics>
<mrow class="MJX-TeXAtom-ORD">
<mstyle displaystyle="true" scriptlevel="0">
<msub>
<mrow class="MJX-TeXAtom-ORD">
<mi>D</mi>
</mrow>
<mrow class="MJX-TeXAtom-ORD">
<mi>n</mi>
</mrow>
</msub>
<mo>=</mo>
<mrow class="MJX-TeXAtom-ORD">
<mfrac>
<msub>
<mrow class="MJX-TeXAtom-ORD">
<mi>B</mi>
</mrow>
<mrow class="MJX-TeXAtom-ORD">
<mi>n</mi>
<mo>−<!-- − --></mo>
<mn>1</mn>
</mrow>
</msub>
<msub>
<mrow class="MJX-TeXAtom-ORD">
<mi>B</mi>
</mrow>
<mrow class="MJX-TeXAtom-ORD">
<mi>n</mi>
</mrow>
</msub>
</mfrac>
</mrow>
</mstyle>
</mrow>
<annotation encoding="application/x-tex">{\displaystyle {D}_{n}={\frac {{B}_{n-1}}{{B}_{n}}}}</annotation>
</semantics>
</math></span><img src="./89d060cc327b47ccb0d744a0ded4e9816668c41f.svg" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -2.338ex; width:12.16ex; height:5.843ex;" alt="{\displaystyle {D}_{n}={\frac {{B}_{n-1}}{{B}_{n}}}}" loading="lazy"></span></dd></dl>
<p>so that the <span class="mwe-math-element mwe-math-element-inline"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle n}">
<semantics>
<mrow class="MJX-TeXAtom-ORD">
<mstyle displaystyle="true" scriptlevel="0">
<mi>n</mi>
</mstyle>
</mrow>
<annotation encoding="application/x-tex">{\displaystyle n}</annotation>
</semantics>
</math></span><img src="./a601995d55609f2d9f5e233e36fbe9ea26011b3b.svg" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.338ex; width:1.395ex; height:1.676ex;" alt="{\displaystyle n}" loading="lazy"></span>th convergent is <span class="mwe-math-element mwe-math-element-inline"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle {f}_{n}={C}_{n}{D}_{n}{f}_{n-1}}">
<semantics>
<mrow class="MJX-TeXAtom-ORD">
<mstyle displaystyle="true" scriptlevel="0">
<msub>
<mrow class="MJX-TeXAtom-ORD">
<mi>f</mi>
</mrow>
<mrow class="MJX-TeXAtom-ORD">
<mi>n</mi>
</mrow>
</msub>
<mo>=</mo>
<msub>
<mrow class="MJX-TeXAtom-ORD">
<mi>C</mi>
</mrow>
<mrow class="MJX-TeXAtom-ORD">
<mi>n</mi>
</mrow>
</msub>
<msub>
<mrow class="MJX-TeXAtom-ORD">
<mi>D</mi>
</mrow>
<mrow class="MJX-TeXAtom-ORD">
<mi>n</mi>
</mrow>
</msub>
<msub>
<mrow class="MJX-TeXAtom-ORD">
<mi>f</mi>
</mrow>
<mrow class="MJX-TeXAtom-ORD">
<mi>n</mi>
<mo>−<!-- − --></mo>
<mn>1</mn>
</mrow>
</msub>
</mstyle>
</mrow>
<annotation encoding="application/x-tex">{\displaystyle {f}_{n}={C}_{n}{D}_{n}{f}_{n-1}}</annotation>
</semantics>
</math></span><img src="./23b6a97914c5fff84663c1ec06d174933b8907ac.svg" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -1.005ex; width:15.937ex; height:2.843ex;" alt="{\displaystyle {f}_{n}={C}_{n}{D}_{n}{f}_{n-1}}" loading="lazy"></span> with <span class="mwe-math-element mwe-math-element-inline"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle {f}_{0}={\frac {{A}_{0}}{{B}_{0}}}={b}_{0}}">
<semantics>
<mrow class="MJX-TeXAtom-ORD">
<mstyle displaystyle="true" scriptlevel="0">
<msub>
<mrow class="MJX-TeXAtom-ORD">
<mi>f</mi>
</mrow>
<mrow class="MJX-TeXAtom-ORD">
<mn>0</mn>
</mrow>
</msub>
<mo>=</mo>
<mrow class="MJX-TeXAtom-ORD">
<mfrac>
<msub>
<mrow class="MJX-TeXAtom-ORD">
<mi>A</mi>
</mrow>
<mrow class="MJX-TeXAtom-ORD">
<mn>0</mn>
</mrow>
</msub>
<msub>
<mrow class="MJX-TeXAtom-ORD">
<mi>B</mi>
</mrow>
<mrow class="MJX-TeXAtom-ORD">
<mn>0</mn>
</mrow>
</msub>
</mfrac>
</mrow>
<mo>=</mo>
<msub>
<mrow class="MJX-TeXAtom-ORD">
<mi>b</mi>
</mrow>
<mrow class="MJX-TeXAtom-ORD">
<mn>0</mn>
</mrow>
</msub>
</mstyle>
</mrow>
<annotation encoding="application/x-tex">{\displaystyle {f}_{0}={\frac {{A}_{0}}{{B}_{0}}}={b}_{0}}</annotation>
</semantics>
</math></span><img src="./b92a37ff3b38f97d6f250f2defc37ee054e501be.svg" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -2.338ex; width:14.097ex; height:5.843ex;" alt="{\displaystyle {f}_{0}={\frac {{A}_{0}}{{B}_{0}}}={b}_{0}}" loading="lazy"></span> and uses the recurrence relations
</p>
<dl><dd><span class="mwe-math-element mwe-math-element-inline"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle {\begin{aligned}{C}_{0}&amp;={\frac {{A}_{0}}{{A}_{-1}}}={b}_{0}&amp;{D}_{0}&amp;={\frac {{B}_{-1}}{{B}_{0}}}=0\\{C}_{n}&amp;={b}_{n}+{\frac {{a}_{n}}{{C}_{n-1}}}&amp;{D}_{n}&amp;={\frac {1}{{b}_{n}+{a}_{n}{D}_{n-1}}}\end{aligned}}}">
<semantics>
<mrow class="MJX-TeXAtom-ORD">
<mstyle displaystyle="true" scriptlevel="0">
<mrow class="MJX-TeXAtom-ORD">
<mtable columnalign="right left right left right left right left right left right left" rowspacing="3pt" columnspacing="0em 2em 0em 2em 0em 2em 0em 2em 0em 2em 0em" displaystyle="true">
<mtr>
<mtd>
<msub>
<mrow class="MJX-TeXAtom-ORD">
<mi>C</mi>
</mrow>
<mrow class="MJX-TeXAtom-ORD">
<mn>0</mn>
</mrow>
</msub>
</mtd>
<mtd>
<mi></mi>
<mo>=</mo>
<mrow class="MJX-TeXAtom-ORD">
<mfrac>
<msub>
<mrow class="MJX-TeXAtom-ORD">
<mi>A</mi>
</mrow>
<mrow class="MJX-TeXAtom-ORD">
<mn>0</mn>
</mrow>
</msub>
<msub>
<mrow class="MJX-TeXAtom-ORD">
<mi>A</mi>
</mrow>
<mrow class="MJX-TeXAtom-ORD">
<mo>−<!-- − --></mo>
<mn>1</mn>
</mrow>
</msub>
</mfrac>
</mrow>
<mo>=</mo>
<msub>
<mrow class="MJX-TeXAtom-ORD">
<mi>b</mi>
</mrow>
<mrow class="MJX-TeXAtom-ORD">
<mn>0</mn>
</mrow>
</msub>
</mtd>
<mtd>
<msub>
<mrow class="MJX-TeXAtom-ORD">
<mi>D</mi>
</mrow>
<mrow class="MJX-TeXAtom-ORD">
<mn>0</mn>
</mrow>
</msub>
</mtd>
<mtd>
<mi></mi>
<mo>=</mo>
<mrow class="MJX-TeXAtom-ORD">
<mfrac>
<msub>
<mrow class="MJX-TeXAtom-ORD">
<mi>B</mi>
</mrow>
<mrow class="MJX-TeXAtom-ORD">
<mo>−<!-- − --></mo>
<mn>1</mn>
</mrow>
</msub>
<msub>
<mrow class="MJX-TeXAtom-ORD">
<mi>B</mi>
</mrow>
<mrow class="MJX-TeXAtom-ORD">
<mn>0</mn>
</mrow>
</msub>
</mfrac>
</mrow>
<mo>=</mo>
<mn>0</mn>
</mtd>
</mtr>
<mtr>
<mtd>
<msub>
<mrow class="MJX-TeXAtom-ORD">
<mi>C</mi>
</mrow>
<mrow class="MJX-TeXAtom-ORD">
<mi>n</mi>
</mrow>
</msub>
</mtd>
<mtd>
<mi></mi>
<mo>=</mo>
<msub>
<mrow class="MJX-TeXAtom-ORD">
<mi>b</mi>
</mrow>
<mrow class="MJX-TeXAtom-ORD">
<mi>n</mi>
</mrow>
</msub>
<mo>+</mo>
<mrow class="MJX-TeXAtom-ORD">
<mfrac>
<msub>
<mrow class="MJX-TeXAtom-ORD">
<mi>a</mi>
</mrow>
<mrow class="MJX-TeXAtom-ORD">
<mi>n</mi>
</mrow>
</msub>
<msub>
<mrow class="MJX-TeXAtom-ORD">
<mi>C</mi>
</mrow>
<mrow class="MJX-TeXAtom-ORD">
<mi>n</mi>
<mo>−<!-- − --></mo>
<mn>1</mn>
</mrow>
</msub>
</mfrac>
</mrow>
</mtd>
<mtd>
<msub>
<mrow class="MJX-TeXAtom-ORD">
<mi>D</mi>
</mrow>
<mrow class="MJX-TeXAtom-ORD">
<mi>n</mi>
</mrow>
</msub>
</mtd>
<mtd>
<mi></mi>
<mo>=</mo>
<mrow class="MJX-TeXAtom-ORD">
<mfrac>
<mn>1</mn>
<mrow>
<msub>
<mrow class="MJX-TeXAtom-ORD">
<mi>b</mi>
</mrow>
<mrow class="MJX-TeXAtom-ORD">
<mi>n</mi>
</mrow>
</msub>
<mo>+</mo>
<msub>
<mrow class="MJX-TeXAtom-ORD">
<mi>a</mi>
</mrow>
<mrow class="MJX-TeXAtom-ORD">
<mi>n</mi>
</mrow>
</msub>
<msub>
<mrow class="MJX-TeXAtom-ORD">
<mi>D</mi>
</mrow>
<mrow class="MJX-TeXAtom-ORD">
<mi>n</mi>
<mo>−<!-- − --></mo>
<mn>1</mn>
</mrow>
</msub>
</mrow>
</mfrac>
</mrow>
</mtd>
</mtr>
</mtable>
</mrow>
</mstyle>
</mrow>
<annotation encoding="application/x-tex">{\displaystyle {\begin{aligned}{C}_{0}&amp;={\frac {{A}_{0}}{{A}_{-1}}}={b}_{0}&amp;{D}_{0}&amp;={\frac {{B}_{-1}}{{B}_{0}}}=0\\{C}_{n}&amp;={b}_{n}+{\frac {{a}_{n}}{{C}_{n-1}}}&amp;{D}_{n}&amp;={\frac {1}{{b}_{n}+{a}_{n}{D}_{n-1}}}\end{aligned}}}</annotation>
</semantics>
</math></span><img src="./927b59d996603ec1f4491111af4357febedcd7c6.svg" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -5.15ex; margin-bottom: -0.188ex; width:42.074ex; height:11.843ex;" alt="{\displaystyle {\begin{aligned}{C}_{0}&amp;={\frac {{A}_{0}}{{A}_{-1}}}={b}_{0}&amp;{D}_{0}&amp;={\frac {{B}_{-1}}{{B}_{0}}}=0\\{C}_{n}&amp;={b}_{n}+{\frac {{a}_{n}}{{C}_{n-1}}}&amp;{D}_{n}&amp;={\frac {1}{{b}_{n}+{a}_{n}{D}_{n-1}}}\end{aligned}}}" loading="lazy"></span></dd></dl>
<p>When the product <span class="mwe-math-element mwe-math-element-inline"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle {C}_{n}{D}_{n}}">
<semantics>
<mrow class="MJX-TeXAtom-ORD">
<mstyle displaystyle="true" scriptlevel="0">
<msub>
<mrow class="MJX-TeXAtom-ORD">
<mi>C</mi>
</mrow>
<mrow class="MJX-TeXAtom-ORD">
<mi>n</mi>
</mrow>
</msub>
<msub>
<mrow class="MJX-TeXAtom-ORD">
<mi>D</mi>
</mrow>
<mrow class="MJX-TeXAtom-ORD">
<mi>n</mi>
</mrow>
</msub>
</mstyle>
</mrow>
<annotation encoding="application/x-tex">{\displaystyle {C}_{n}{D}_{n}}</annotation>
</semantics>
</math></span><img src="./bc231803c323982fd3beb05a0abbfe814ed689c3.svg" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.671ex; width:6.023ex; height:2.509ex;" alt="{\displaystyle {C}_{n}{D}_{n}}" loading="lazy"></span> approaches unity with increasing <span class="mwe-math-element mwe-math-element-inline"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle n}">
<semantics>
<mrow class="MJX-TeXAtom-ORD">
<mstyle displaystyle="true" scriptlevel="0">
<mi>n</mi>
</mstyle>
</mrow>
<annotation encoding="application/x-tex">{\displaystyle n}</annotation>
</semantics>
</math></span><img src="./a601995d55609f2d9f5e233e36fbe9ea26011b3b.svg" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.338ex; width:1.395ex; height:1.676ex;" alt="{\displaystyle n}" loading="lazy"></span>, it is hoped that <span class="mwe-math-element mwe-math-element-inline"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle {f}_{n}}">
<semantics>
<mrow class="MJX-TeXAtom-ORD">
<mstyle displaystyle="true" scriptlevel="0">
<msub>
<mrow class="MJX-TeXAtom-ORD">
<mi>f</mi>
</mrow>
<mrow class="MJX-TeXAtom-ORD">
<mi>n</mi>
</mrow>
</msub>
</mstyle>
</mrow>
<annotation encoding="application/x-tex">{\displaystyle {f}_{n}}</annotation>
</semantics>
</math></span><img src="./76a7ec98160e69214bbddb1853284a068a50768c.svg" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.838ex; width:2.358ex; height:2.676ex;" alt="{\displaystyle {f}_{n}}" loading="lazy"></span> has converged to <span class="mwe-math-element mwe-math-element-inline"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle f}">
<semantics>
<mrow class="MJX-TeXAtom-ORD">
<mstyle displaystyle="true" scriptlevel="0">
<mi>f</mi>
</mstyle>
</mrow>
<annotation encoding="application/x-tex">{\displaystyle f}</annotation>
</semantics>
</math></span><img src="./132e57acb643253e7810ee9702d9581f159a1c61.svg" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.671ex; width:1.279ex; height:2.509ex;" alt="{\displaystyle f}" loading="lazy"></span>.<sup id="cite_ref-Numerical-Recipes_8-0" class="reference"><a href="#cite_note-Numerical-Recipes-8"><span class="cite-bracket">[</span>8<span class="cite-bracket">]</span></a></sup>
</p><p>Lentz's algorithm has the advantage of side-stepping an inconvenience of the Wallis-Euler relations, namely that the numerators <span class="mwe-math-element mwe-math-element-inline"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle A_{n}}">
<semantics>
<mrow class="MJX-TeXAtom-ORD">
<mstyle displaystyle="true" scriptlevel="0">
<msub>
<mi>A</mi>
<mrow class="MJX-TeXAtom-ORD">
<mi>n</mi>
</mrow>
</msub>
</mstyle>
</mrow>
<annotation encoding="application/x-tex">{\displaystyle A_{n}}</annotation>
</semantics>
</math></span><img src="./730f6906700685b6d52f3958b1c2ae659d2d97d2.svg" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.671ex; width:2.962ex; height:2.509ex;" alt="{\displaystyle A_{n}}" loading="lazy"></span> and denominators <span class="mwe-math-element mwe-math-element-inline"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle B_{n}}">
<semantics>
<mrow class="MJX-TeXAtom-ORD">
<mstyle displaystyle="true" scriptlevel="0">
<msub>
<mi>B</mi>
<mrow class="MJX-TeXAtom-ORD">
<mi>n</mi>
</mrow>
</msub>
</mstyle>
</mrow>
<annotation encoding="application/x-tex">{\displaystyle B_{n}}</annotation>
</semantics>
</math></span><img src="./2f568bf6d34e97b9fdda0dc7e276d6c4501d2045.svg" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.671ex; width:2.982ex; height:2.509ex;" alt="{\displaystyle B_{n}}" loading="lazy"></span> are prone to grow or diminish very rapidly with increasing <span class="mwe-math-element mwe-math-element-inline"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle n}">
<semantics>
<mrow class="MJX-TeXAtom-ORD">
<mstyle displaystyle="true" scriptlevel="0">
<mi>n</mi>
</mstyle>
</mrow>
<annotation encoding="application/x-tex">{\displaystyle n}</annotation>
</semantics>
</math></span><img src="./a601995d55609f2d9f5e233e36fbe9ea26011b3b.svg" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.338ex; width:1.395ex; height:1.676ex;" alt="{\displaystyle n}" loading="lazy"></span>. In direct numerical application of the Wallis-Euler relations, this means that <span class="mwe-math-element mwe-math-element-inline"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle A_{n-1}}">
<semantics>
<mrow class="MJX-TeXAtom-ORD">
<mstyle displaystyle="true" scriptlevel="0">
<msub>
<mi>A</mi>
<mrow class="MJX-TeXAtom-ORD">
<mi>n</mi>
<mo>−<!-- − --></mo>
<mn>1</mn>
</mrow>
</msub>
</mstyle>
</mrow>
<annotation encoding="application/x-tex">{\displaystyle A_{n-1}}</annotation>
</semantics>
</math></span><img src="./b576e75f0336d126580faaad6039e2e84f6f3ee2.svg" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.671ex; width:5.062ex; height:2.509ex;" alt="{\displaystyle A_{n-1}}" loading="lazy"></span>, <span class="mwe-math-element mwe-math-element-inline"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle A_{n-2}}">
<semantics>
<mrow class="MJX-TeXAtom-ORD">
<mstyle displaystyle="true" scriptlevel="0">
<msub>
<mi>A</mi>
<mrow class="MJX-TeXAtom-ORD">
<mi>n</mi>
<mo>−<!-- − --></mo>
<mn>2</mn>
</mrow>
</msub>
</mstyle>
</mrow>
<annotation encoding="application/x-tex">{\displaystyle A_{n-2}}</annotation>
</semantics>
</math></span><img src="./d06b40157dd6c080023f50cbc7754140a552d90f.svg" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.671ex; width:5.062ex; height:2.509ex;" alt="{\displaystyle A_{n-2}}" loading="lazy"></span>, <span class="mwe-math-element mwe-math-element-inline"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle B_{n-1}}">
<semantics>
<mrow class="MJX-TeXAtom-ORD">
<mstyle displaystyle="true" scriptlevel="0">
<msub>
<mi>B</mi>
<mrow class="MJX-TeXAtom-ORD">
<mi>n</mi>
<mo>−<!-- − --></mo>
<mn>1</mn>
</mrow>
</msub>
</mstyle>
</mrow>
<annotation encoding="application/x-tex">{\displaystyle B_{n-1}}</annotation>
</semantics>
</math></span><img src="./35a38fdd982d39522072e328364b4ccec132f6dc.svg" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.671ex; width:5.083ex; height:2.509ex;" alt="{\displaystyle B_{n-1}}" loading="lazy"></span>, <span class="mwe-math-element mwe-math-element-inline"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle B_{n-2}}">
<semantics>
<mrow class="MJX-TeXAtom-ORD">
<mstyle displaystyle="true" scriptlevel="0">
<msub>
<mi>B</mi>
<mrow class="MJX-TeXAtom-ORD">
<mi>n</mi>
<mo>−<!-- − --></mo>
<mn>2</mn>
</mrow>
</msub>
</mstyle>
</mrow>
<annotation encoding="application/x-tex">{\displaystyle B_{n-2}}</annotation>
</semantics>
</math></span><img src="./ef9fccee51766d46ca6e7ca6e427f9019bd332d0.svg" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.671ex; width:5.083ex; height:2.509ex;" alt="{\displaystyle B_{n-2}}" loading="lazy"></span> must be periodically checked and rescaled to avoid floating-point overflow or underflow.<sup id="cite_ref-Numerical-Recipes_8-1" class="reference"><a href="#cite_note-Numerical-Recipes-8"><span class="cite-bracket">[</span>8<span class="cite-bracket">]</span></a></sup>
</p>
<div class="mw-heading mw-heading2"><h2 id="Thompson_and_Barnett_modification">Thompson and Barnett modification</h2></div>
<p>In Lentz's original algorithm, it can happen that <span class="mwe-math-element mwe-math-element-inline"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle {C}_{n}=0}">
<semantics>
<mrow class="MJX-TeXAtom-ORD">
<mstyle displaystyle="true" scriptlevel="0">
<msub>
<mrow class="MJX-TeXAtom-ORD">
<mi>C</mi>
</mrow>
<mrow class="MJX-TeXAtom-ORD">
<mi>n</mi>
</mrow>
</msub>
<mo>=</mo>
<mn>0</mn>
</mstyle>
</mrow>
<annotation encoding="application/x-tex">{\displaystyle {C}_{n}=0}</annotation>
</semantics>
</math></span><img src="./0c6dc979df0e4e1b0192e733db13c96419980088.svg" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.671ex; width:7.141ex; height:2.509ex;" alt="{\displaystyle {C}_{n}=0}" loading="lazy"></span>, resulting in division by zero at the next step. The problem can be remedied simply by setting <span class="mwe-math-element mwe-math-element-inline"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle {C}_{n}=\varepsilon }">
<semantics>
<mrow class="MJX-TeXAtom-ORD">
<mstyle displaystyle="true" scriptlevel="0">
<msub>
<mrow class="MJX-TeXAtom-ORD">
<mi>C</mi>
</mrow>
<mrow class="MJX-TeXAtom-ORD">
<mi>n</mi>
</mrow>
</msub>
<mo>=</mo>
<mi>ε<!-- ε --></mi>
</mstyle>
</mrow>
<annotation encoding="application/x-tex">{\displaystyle {C}_{n}=\varepsilon }</annotation>
</semantics>
</math></span><img src="./c9dc00f2641ceaad6c7e2dfb6c5c56daf0514e3d.svg" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.671ex; width:7.062ex; height:2.509ex;" alt="{\displaystyle {C}_{n}=\varepsilon }" loading="lazy"></span> for some sufficiently small <span class="mwe-math-element mwe-math-element-inline"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle \varepsilon }">
<semantics>
<mrow class="MJX-TeXAtom-ORD">
<mstyle displaystyle="true" scriptlevel="0">
<mi>ε<!-- ε --></mi>
</mstyle>
</mrow>
<annotation encoding="application/x-tex">{\displaystyle \varepsilon }</annotation>
</semantics>
</math></span><img src="./a30c89172e5b88edbd45d3e2772c7f5e562e5173.svg" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.338ex; width:1.083ex; height:1.676ex;" alt="{\displaystyle \varepsilon }" loading="lazy"></span>. This gives <span class="mwe-math-element mwe-math-element-inline"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle {C}_{n+1}={b}_{n+1}+{\frac {{a}_{n+1}}{\varepsilon }}={\frac {{a}_{n+1}}{\varepsilon }}}">
<semantics>
<mrow class="MJX-TeXAtom-ORD">
<mstyle displaystyle="true" scriptlevel="0">
<msub>
<mrow class="MJX-TeXAtom-ORD">
<mi>C</mi>
</mrow>
<mrow class="MJX-TeXAtom-ORD">
<mi>n</mi>
<mo>+</mo>
<mn>1</mn>
</mrow>
</msub>
<mo>=</mo>
<msub>
<mrow class="MJX-TeXAtom-ORD">
<mi>b</mi>
</mrow>
<mrow class="MJX-TeXAtom-ORD">
<mi>n</mi>
<mo>+</mo>
<mn>1</mn>
</mrow>
</msub>
<mo>+</mo>
<mrow class="MJX-TeXAtom-ORD">
<mfrac>
<msub>
<mrow class="MJX-TeXAtom-ORD">
<mi>a</mi>
</mrow>
<mrow class="MJX-TeXAtom-ORD">
<mi>n</mi>
<mo>+</mo>
<mn>1</mn>
</mrow>
</msub>
<mi>ε<!-- ε --></mi>
</mfrac>
</mrow>
<mo>=</mo>
<mrow class="MJX-TeXAtom-ORD">
<mfrac>
<msub>
<mrow class="MJX-TeXAtom-ORD">
<mi>a</mi>
</mrow>
<mrow class="MJX-TeXAtom-ORD">
<mi>n</mi>
<mo>+</mo>
<mn>1</mn>
</mrow>
</msub>
<mi>ε<!-- ε --></mi>
</mfrac>
</mrow>
</mstyle>
</mrow>
<annotation encoding="application/x-tex">{\displaystyle {C}_{n+1}={b}_{n+1}+{\frac {{a}_{n+1}}{\varepsilon }}={\frac {{a}_{n+1}}{\varepsilon }}}</annotation>
</semantics>
</math></span><img src="./95573493387e6cdb265b1f1815590a46783d6e4a.svg" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -1.838ex; width:29.105ex; height:4.843ex;" alt="{\displaystyle {C}_{n+1}={b}_{n+1}+{\frac {{a}_{n+1}}{\varepsilon }}={\frac {{a}_{n+1}}{\varepsilon }}}" loading="lazy"></span> to within floating-point precision, and the product <span class="mwe-math-element mwe-math-element-inline"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle {C}_{n}{C}_{n+1}={a}_{n+1}}">
<semantics>
<mrow class="MJX-TeXAtom-ORD">
<mstyle displaystyle="true" scriptlevel="0">
<msub>
<mrow class="MJX-TeXAtom-ORD">
<mi>C</mi>
</mrow>
<mrow class="MJX-TeXAtom-ORD">
<mi>n</mi>
</mrow>
</msub>
<msub>
<mrow class="MJX-TeXAtom-ORD">
<mi>C</mi>
</mrow>
<mrow class="MJX-TeXAtom-ORD">
<mi>n</mi>
<mo>+</mo>
<mn>1</mn>
</mrow>
</msub>
<mo>=</mo>
<msub>
<mrow class="MJX-TeXAtom-ORD">
<mi>a</mi>
</mrow>
<mrow class="MJX-TeXAtom-ORD">
<mi>n</mi>
<mo>+</mo>
<mn>1</mn>
</mrow>
</msub>
</mstyle>
</mrow>
<annotation encoding="application/x-tex">{\displaystyle {C}_{n}{C}_{n+1}={a}_{n+1}}</annotation>
</semantics>
</math></span><img src="./20b6224e5ea3e6116601a8d03dae8f5a6f1abf73.svg" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.671ex; width:15.508ex; height:2.509ex;" alt="{\displaystyle {C}_{n}{C}_{n+1}={a}_{n+1}}" loading="lazy"></span> irrespective of the precise value of ε. Accordingly, the value of <span class="mwe-math-element mwe-math-element-inline"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle {f}_{0}={C}_{0}={b}_{0}}">
<semantics>
<mrow class="MJX-TeXAtom-ORD">
<mstyle displaystyle="true" scriptlevel="0">
<msub>
<mrow class="MJX-TeXAtom-ORD">
<mi>f</mi>
</mrow>
<mrow class="MJX-TeXAtom-ORD">
<mn>0</mn>
</mrow>
</msub>
<mo>=</mo>
<msub>
<mrow class="MJX-TeXAtom-ORD">
<mi>C</mi>
</mrow>
<mrow class="MJX-TeXAtom-ORD">
<mn>0</mn>
</mrow>
</msub>
<mo>=</mo>
<msub>
<mrow class="MJX-TeXAtom-ORD">
<mi>b</mi>
</mrow>
<mrow class="MJX-TeXAtom-ORD">
<mn>0</mn>
</mrow>
</msub>
</mstyle>
</mrow>
<annotation encoding="application/x-tex">{\displaystyle {f}_{0}={C}_{0}={b}_{0}}</annotation>
</semantics>
</math></span><img src="./493a73b10262a44bcdfa5a31b112adcbccafaacf.svg" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.838ex; width:13.158ex; height:2.676ex;" alt="{\displaystyle {f}_{0}={C}_{0}={b}_{0}}" loading="lazy"></span> is also set to <span class="mwe-math-element mwe-math-element-inline"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle \varepsilon }">
<semantics>
<mrow class="MJX-TeXAtom-ORD">
<mstyle displaystyle="true" scriptlevel="0">
<mi>ε<!-- ε --></mi>
</mstyle>
</mrow>
<annotation encoding="application/x-tex">{\displaystyle \varepsilon }</annotation>
</semantics>
</math></span><img src="./a30c89172e5b88edbd45d3e2772c7f5e562e5173.svg" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.338ex; width:1.083ex; height:1.676ex;" alt="{\displaystyle \varepsilon }" loading="lazy"></span> in the case of <span class="mwe-math-element mwe-math-element-inline"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle {b}_{0}=0}">
<semantics>
<mrow class="MJX-TeXAtom-ORD">
<mstyle displaystyle="true" scriptlevel="0">
<msub>
<mrow class="MJX-TeXAtom-ORD">
<mi>b</mi>
</mrow>
<mrow class="MJX-TeXAtom-ORD">
<mn>0</mn>
</mrow>
</msub>
<mo>=</mo>
<mn>0</mn>
</mstyle>
</mrow>
<annotation encoding="application/x-tex">{\displaystyle {b}_{0}=0}</annotation>
</semantics>
</math></span><img src="./e87ec6d0bc29cbac18ed6af6e9e3e94036ced7ec.svg" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.671ex; width:6.313ex; height:2.509ex;" alt="{\displaystyle {b}_{0}=0}" loading="lazy"></span>.
</p><p>Similarly, if the denominator in <span class="mwe-math-element mwe-math-element-inline"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle {D}_{n}={\frac {1}{{b}_{n}+{a}_{n}{D}_{n-1}}}}">
<semantics>
<mrow class="MJX-TeXAtom-ORD">
<mstyle displaystyle="true" scriptlevel="0">
<msub>
<mrow class="MJX-TeXAtom-ORD">
<mi>D</mi>
</mrow>
<mrow class="MJX-TeXAtom-ORD">
<mi>n</mi>
</mrow>
</msub>
<mo>=</mo>
<mrow class="MJX-TeXAtom-ORD">
<mfrac>
<mn>1</mn>
<mrow>
<msub>
<mrow class="MJX-TeXAtom-ORD">
<mi>b</mi>
</mrow>
<mrow class="MJX-TeXAtom-ORD">
<mi>n</mi>
</mrow>
</msub>
<mo>+</mo>
<msub>
<mrow class="MJX-TeXAtom-ORD">
<mi>a</mi>
</mrow>
<mrow class="MJX-TeXAtom-ORD">
<mi>n</mi>
</mrow>
</msub>
<msub>
<mrow class="MJX-TeXAtom-ORD">
<mi>D</mi>
</mrow>
<mrow class="MJX-TeXAtom-ORD">
<mi>n</mi>
<mo>−<!-- − --></mo>
<mn>1</mn>
</mrow>
</msub>
</mrow>
</mfrac>
</mrow>
</mstyle>
</mrow>
<annotation encoding="application/x-tex">{\displaystyle {D}_{n}={\frac {1}{{b}_{n}+{a}_{n}{D}_{n-1}}}}</annotation>
</semantics>
</math></span><img src="./d30ec8be08148270369071188bd6a5418e72b718.svg" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -2.338ex; width:19.825ex; height:5.676ex;" alt="{\displaystyle {D}_{n}={\frac {1}{{b}_{n}+{a}_{n}{D}_{n-1}}}}" loading="lazy"></span> is zero, then setting <span class="mwe-math-element mwe-math-element-inline"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle {D}_{n}={\frac {1}{\varepsilon }}}">
<semantics>
<mrow class="MJX-TeXAtom-ORD">
<mstyle displaystyle="true" scriptlevel="0">
<msub>
<mrow class="MJX-TeXAtom-ORD">
<mi>D</mi>
</mrow>
<mrow class="MJX-TeXAtom-ORD">
<mi>n</mi>
</mrow>
</msub>
<mo>=</mo>
<mrow class="MJX-TeXAtom-ORD">
<mfrac>
<mn>1</mn>
<mi>ε<!-- ε --></mi>
</mfrac>
</mrow>
</mstyle>
</mrow>
<annotation encoding="application/x-tex">{\displaystyle {D}_{n}={\frac {1}{\varepsilon }}}</annotation>
</semantics>
</math></span><img src="./ba6edc7fc3d577cecf3c14833dcca9b31ee59910.svg" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -1.838ex; width:8.24ex; height:5.176ex;" alt="{\displaystyle {D}_{n}={\frac {1}{\varepsilon }}}" loading="lazy"></span> for small enough <span class="mwe-math-element mwe-math-element-inline"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle \varepsilon }">
<semantics>
<mrow class="MJX-TeXAtom-ORD">
<mstyle displaystyle="true" scriptlevel="0">
<mi>ε<!-- ε --></mi>
</mstyle>
</mrow>
<annotation encoding="application/x-tex">{\displaystyle \varepsilon }</annotation>
</semantics>
</math></span><img src="./a30c89172e5b88edbd45d3e2772c7f5e562e5173.svg" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.338ex; width:1.083ex; height:1.676ex;" alt="{\displaystyle \varepsilon }" loading="lazy"></span> gives <span class="mwe-math-element mwe-math-element-inline"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle {D}_{n}{D}_{n+1}={\frac {1}{{a}_{n+1}}}}">
<semantics>
<mrow class="MJX-TeXAtom-ORD">
<mstyle displaystyle="true" scriptlevel="0">
<msub>
<mrow class="MJX-TeXAtom-ORD">
<mi>D</mi>
</mrow>
<mrow class="MJX-TeXAtom-ORD">
<mi>n</mi>
</mrow>
</msub>
<msub>
<mrow class="MJX-TeXAtom-ORD">
<mi>D</mi>
</mrow>
<mrow class="MJX-TeXAtom-ORD">
<mi>n</mi>
<mo>+</mo>
<mn>1</mn>
</mrow>
</msub>
<mo>=</mo>
<mrow class="MJX-TeXAtom-ORD">
<mfrac>
<mn>1</mn>
<msub>
<mrow class="MJX-TeXAtom-ORD">
<mi>a</mi>
</mrow>
<mrow class="MJX-TeXAtom-ORD">
<mi>n</mi>
<mo>+</mo>
<mn>1</mn>
</mrow>
</msub>
</mfrac>
</mrow>
</mstyle>
</mrow>
<annotation encoding="application/x-tex">{\displaystyle {D}_{n}{D}_{n+1}={\frac {1}{{a}_{n+1}}}}</annotation>
</semantics>
</math></span><img src="./826a90cce507b3faa8e1a571a7d35a8595d62662.svg" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -2.338ex; width:16.869ex; height:5.676ex;" alt="{\displaystyle {D}_{n}{D}_{n+1}={\frac {1}{{a}_{n+1}}}}" loading="lazy"></span> irrespective of the value of <span class="mwe-math-element mwe-math-element-inline"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle \varepsilon }">
<semantics>
<mrow class="MJX-TeXAtom-ORD">
<mstyle displaystyle="true" scriptlevel="0">
<mi>ε<!-- ε --></mi>
</mstyle>
</mrow>
<annotation encoding="application/x-tex">{\displaystyle \varepsilon }</annotation>
</semantics>
</math></span><img src="./a30c89172e5b88edbd45d3e2772c7f5e562e5173.svg" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.338ex; width:1.083ex; height:1.676ex;" alt="{\displaystyle \varepsilon }" loading="lazy"></span>.<sup id="cite_ref-Thompson-and-Barnett_3-2" class="reference"><a href="#cite_note-Thompson-and-Barnett-3"><span class="cite-bracket">[</span>3<span class="cite-bracket">]</span></a></sup><sup id="cite_ref-Numerical-Recipes_8-2" class="reference"><a href="#cite_note-Numerical-Recipes-8"><span class="cite-bracket">[</span>8<span class="cite-bracket">]</span></a></sup>
</p>
<div class="mw-heading mw-heading2"><h2 id="Applications">Applications</h2></div>
<p>Lentz's algorithm was used widely in the late twentieth century. It was suggested that it doesn't have any rigorous analysis of error propagation. However, a few empirical tests suggest that it's at least as good as the other methods.<sup id="cite_ref-9" class="reference"><a href="#cite_note-9"><span class="cite-bracket">[</span>9<span class="cite-bracket">]</span></a></sup> As an example, it was applied to evaluate exponential integral functions. This application was then called modified Lentz algorithm.<sup id="cite_ref-10" class="reference"><a href="#cite_note-10"><span class="cite-bracket">[</span>10<span class="cite-bracket">]</span></a></sup> It's also stated that the Lentz algorithm is not applicable for every calculation, and convergence can be quite rapid for some continued fractions and vice versa for others.<sup id="cite_ref-11" class="reference"><a href="#cite_note-11"><span class="cite-bracket">[</span>11<span class="cite-bracket">]</span></a></sup>
</p>
<div class="mw-heading mw-heading2"><h2 id="References">References</h2></div>
<style data-mw-deduplicate="TemplateStyles:r1239543626">
/* start https://en.wikipedia.org/ */


.mw-parser-output .reflist{margin-bottom:0.5em;list-style-type:decimal}@media screen{.mw-parser-output .reflist{font-size:90%}}.mw-parser-output .reflist .references{font-size:100%;margin-bottom:0;list-style-type:inherit}.mw-parser-output .reflist-columns-2{column-width:30em}.mw-parser-output .reflist-columns-3{column-width:25em}.mw-parser-output .reflist-columns{margin-top:0.3em}.mw-parser-output .reflist-columns ol{margin-top:0}.mw-parser-output .reflist-columns li{page-break-inside:avoid;break-inside:avoid-column}.mw-parser-output .reflist-upper-alpha{list-style-type:upper-alpha}.mw-parser-output .reflist-upper-roman{list-style-type:upper-roman}.mw-parser-output .reflist-lower-alpha{list-style-type:lower-alpha}.mw-parser-output .reflist-lower-greek{list-style-type:lower-greek}.mw-parser-output .reflist-lower-roman{list-style-type:lower-roman}


/* end https://en.wikipedia.org/ */
</style><div class="reflist">
<div class="mw-references-wrap mw-references-columns"><ol class="references">
<li id="cite_note-:0-1"><span class="mw-cite-backlink">^ <a href="#cite_ref-:0_1-0"><sup><i><b>a</b></i></sup></a> <a href="#cite_ref-:0_1-1"><sup><i><b>b</b></i></sup></a></span> <span class="reference-text"><style data-mw-deduplicate="TemplateStyles:r1238218222">
/* start https://en.wikipedia.org/ */


.mw-parser-output cite.citation{font-style:inherit;word-wrap:break-word}.mw-parser-output .citation q{quotes:"\"""\"""'""'"}.mw-parser-output .citation:target{background-color:rgba(0,127,255,0.133)}.mw-parser-output .id-lock-free.id-lock-free a{background:url("./mw/Lock-green.svg")right 0.1em center/9px no-repeat}.mw-parser-output .id-lock-limited.id-lock-limited a,.mw-parser-output .id-lock-registration.id-lock-registration a{background:url("./mw/Lock-gray-alt-2.svg")right 0.1em center/9px no-repeat}.mw-parser-output .id-lock-subscription.id-lock-subscription a{background:url("./mw/Lock-red-alt-2.svg")right 0.1em center/9px no-repeat}.mw-parser-output .cs1-ws-icon a{background:url("./mw/Wikisource-logo.svg")right 0.1em center/12px no-repeat}body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .id-lock-free a,body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .id-lock-limited a,body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .id-lock-registration a,body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .id-lock-subscription a,body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .cs1-ws-icon a{background-size:contain;padding:0 1em 0 0}.mw-parser-output .cs1-code{color:inherit;background:inherit;border:none;padding:inherit}.mw-parser-output .cs1-hidden-error{display:none;color:var(--color-error,#d33)}.mw-parser-output .cs1-visible-error{color:var(--color-error,#d33)}.mw-parser-output .cs1-maint{display:none;color:#085;margin-left:0.3em}.mw-parser-output .cs1-kern-left{padding-left:0.2em}.mw-parser-output .cs1-kern-right{padding-right:0.2em}.mw-parser-output .citation .mw-selflink{font-weight:inherit}@media screen{.mw-parser-output .cs1-format{font-size:95%}html.skin-theme-clientpref-night .mw-parser-output .cs1-maint{color:#18911f}}@media screen and (prefers-color-scheme:dark){html.skin-theme-clientpref-os .mw-parser-output .cs1-maint{color:#18911f}}


/* end https://en.wikipedia.org/ */
</style><cite id="CITEREFLentz1973" class="citation report cs1">Lentz, W. J. (September 1973). <a rel="nofollow" class="external text" href="https://apps.dtic.mil/sti/pdfs/AD0767223.pdf">A Method of Computing Spherical Bessel Functions of Complex Argument with Tables</a> <span class="cs1-format">(PDF)</span> (Research and Development Technical Report ECOM-5509). White Sands Missile Range, New Mexico: Atmospheric Sciences Laboratory, US Army Electronics Command.</cite></span>
</li>
<li id="cite_note-numerical-recipes-c++-2"><span class="mw-cite-backlink"><b><a href="#cite_ref-numerical-recipes-c++_2-0">^</a></b></span> <span class="reference-text"><cite class="citation book cs1"><i>Numerical Recipes in C++</i>. pp.&nbsp;<span class="nowrap">177–</span>179. <a href="ISBN_(identifier)" class="mw-redirect" title="ISBN (identifier)">ISBN</a>&nbsp;<bdi>0 521 75033 4</bdi>.</cite></span>
</li>
<li id="cite_note-Thompson-and-Barnett-3"><span class="mw-cite-backlink">^ <a href="#cite_ref-Thompson-and-Barnett_3-0"><sup><i><b>a</b></i></sup></a> <a href="#cite_ref-Thompson-and-Barnett_3-1"><sup><i><b>b</b></i></sup></a> <a href="#cite_ref-Thompson-and-Barnett_3-2"><sup><i><b>c</b></i></sup></a></span> <span class="reference-text"><cite id="CITEREFThompsonBarnett1986" class="citation journal cs1">Thompson, I.J.; Barnett, A.R. (1986). <span class="id-lock-subscription" title="Paid subscription required"><a rel="nofollow" class="external text" href="https://dx.doi.org/10.1016/0021-9991(86)90046-x">"Coulomb and Bessel functions of complex arguments and order"</a></span>. <i>Journal of Computational Physics</i>. <b>64</b> (2): <span class="nowrap">490–</span>509. <a href="Bibcode_(identifier)" class="mw-redirect" title="Bibcode (identifier)">Bibcode</a>:<a rel="nofollow" class="external text" href="https://ui.adsabs.harvard.edu/abs/1986JCoPh..64..490T">1986JCoPh..64..490T</a>. <a href="Doi_(identifier)" class="mw-redirect" title="Doi (identifier)">doi</a>:<a rel="nofollow" class="external text" href="https://doi.org/10.1016%2F0021-9991%2886%2990046-x">10.1016/0021-9991(86)90046-x</a>. <a href="ISSN_(identifier)" class="mw-redirect" title="ISSN (identifier)">ISSN</a>&nbsp;<a rel="nofollow" class="external text" href="https://search.worldcat.org/issn/0021-9991">0021-9991</a>.</cite></span>
</li>
<li id="cite_note-4"><span class="mw-cite-backlink"><b><a href="#cite_ref-4">^</a></b></span> <span class="reference-text"><cite id="CITEREFJ.1982" class="citation book cs1">J., Lentz, W. (August 1982). <a rel="nofollow" class="external text" href="http://worldcat.org/oclc/227549426"><i>A Simplification of Lentz's Algorithm</i></a>. Defense Technical Information Center. <a href="OCLC_(identifier)" class="mw-redirect" title="OCLC (identifier)">OCLC</a>&nbsp;<a rel="nofollow" class="external text" href="https://search.worldcat.org/oclc/227549426">227549426</a>.</cite><span class="cs1-maint citation-comment"><code class="cs1-code">{{cite book}}</code>: CS1 maint: multiple names: authors list (link)</span></span>
</li>
<li id="cite_note-Lentz_668–671-5"><span class="mw-cite-backlink">^ <a href="#cite_ref-Lentz_668–671_5-0"><sup><i><b>a</b></i></sup></a> <a href="#cite_ref-Lentz_668–671_5-1"><sup><i><b>b</b></i></sup></a></span> <span class="reference-text"><cite id="CITEREFLentz1976" class="citation journal cs1">Lentz, William J. (1976-03-01). <span class="id-lock-subscription" title="Paid subscription required"><a rel="nofollow" class="external text" href="https://dx.doi.org/10.1364/ao.15.000668">"Generating Bessel functions in Mie scattering calculations using continued fractions"</a></span>. <i>Applied Optics</i>. <b>15</b> (3): <span class="nowrap">668–</span>671. <a href="Bibcode_(identifier)" class="mw-redirect" title="Bibcode (identifier)">Bibcode</a>:<a rel="nofollow" class="external text" href="https://ui.adsabs.harvard.edu/abs/1976ApOpt..15..668L">1976ApOpt..15..668L</a>. <a href="Doi_(identifier)" class="mw-redirect" title="Doi (identifier)">doi</a>:<a rel="nofollow" class="external text" href="https://doi.org/10.1364%2Fao.15.000668">10.1364/ao.15.000668</a>. <a href="ISSN_(identifier)" class="mw-redirect" title="ISSN (identifier)">ISSN</a>&nbsp;<a rel="nofollow" class="external text" href="https://search.worldcat.org/issn/0003-6935">0003-6935</a>. <a href="PMID_(identifier)" class="mw-redirect" title="PMID (identifier)">PMID</a>&nbsp;<a rel="nofollow" class="external text" href="https://pubmed.ncbi.nlm.nih.gov/20165036">20165036</a>.</cite></span>
</li>
<li id="cite_note-6"><span class="mw-cite-backlink"><b><a href="#cite_ref-6">^</a></b></span> <span class="reference-text"><cite id="CITEREFJaaskelainenRuuskanen1981" class="citation journal cs1">Jaaskelainen, T.; Ruuskanen, J. (1981-10-01). <span class="id-lock-subscription" title="Paid subscription required"><a rel="nofollow" class="external text" href="https://dx.doi.org/10.1364/ao.20.003289">"Note on Lentz's algorithm"</a></span>. <i>Applied Optics</i>. <b>20</b> (19): <span class="nowrap">3289–</span>3290. <a href="Bibcode_(identifier)" class="mw-redirect" title="Bibcode (identifier)">Bibcode</a>:<a rel="nofollow" class="external text" href="https://ui.adsabs.harvard.edu/abs/1981ApOpt..20.3289J">1981ApOpt..20.3289J</a>. <a href="Doi_(identifier)" class="mw-redirect" title="Doi (identifier)">doi</a>:<a rel="nofollow" class="external text" href="https://doi.org/10.1364%2Fao.20.003289">10.1364/ao.20.003289</a>. <a href="ISSN_(identifier)" class="mw-redirect" title="ISSN (identifier)">ISSN</a>&nbsp;<a rel="nofollow" class="external text" href="https://search.worldcat.org/issn/0003-6935">0003-6935</a>. <a href="PMID_(identifier)" class="mw-redirect" title="PMID (identifier)">PMID</a>&nbsp;<a rel="nofollow" class="external text" href="https://pubmed.ncbi.nlm.nih.gov/20333144">20333144</a>.</cite></span>
</li>
<li id="cite_note-7"><span class="mw-cite-backlink"><b><a href="#cite_ref-7">^</a></b></span> <span class="reference-text"><cite id="CITEREFMasmoudiBouhlelPuech2012" class="citation book cs1">Masmoudi, Atef; Bouhlel, Med Salim; Puech, William (March 2012). <a rel="nofollow" class="external text" href="https://dx.doi.org/10.1109/setit.2012.6481959">"Image encryption using chaotic standard map and engle continued fractions map"</a>. <i>2012 6th International Conference on Sciences of Electronics, Technologies of Information and Telecommunications (SETIT)</i>. IEEE. pp.&nbsp;<span class="nowrap">474–</span>480. <a href="Doi_(identifier)" class="mw-redirect" title="Doi (identifier)">doi</a>:<a rel="nofollow" class="external text" href="https://doi.org/10.1109%2Fsetit.2012.6481959">10.1109/setit.2012.6481959</a>. <a href="ISBN_(identifier)" class="mw-redirect" title="ISBN (identifier)">ISBN</a>&nbsp;<bdi>978-1-4673-1658-3</bdi>. <a href="S2CID_(identifier)" class="mw-redirect" title="S2CID (identifier)">S2CID</a>&nbsp;<a rel="nofollow" class="external text" href="https://api.semanticscholar.org/CorpusID:15380706">15380706</a>.</cite></span>
</li>
<li id="cite_note-Numerical-Recipes-8"><span class="mw-cite-backlink">^ <a href="#cite_ref-Numerical-Recipes_8-0"><sup><i><b>a</b></i></sup></a> <a href="#cite_ref-Numerical-Recipes_8-1"><sup><i><b>b</b></i></sup></a> <a href="#cite_ref-Numerical-Recipes_8-2"><sup><i><b>c</b></i></sup></a></span> <span class="reference-text"><cite id="CITEREFPressTeukolskyVetterlingFlannery2007" class="citation book cs1">Press, W.H.; Teukolsky, S.A.; Vetterling, W.T.; Flannery, B. P. (2007). <i>Numerical Recipes: The Art of Scientific Computing</i> (3rd&nbsp;ed.). Cambridge University Press. pp.&nbsp;<span class="nowrap">207–</span>208.</cite></span>
</li>
<li id="cite_note-9"><span class="mw-cite-backlink"><b><a href="#cite_ref-9">^</a></b></span> <span class="reference-text"><cite id="CITEREFPressTeukolskyVetterlingFlannery1992" class="citation book cs1">Press, W.H.; Teukolsky, S.A.; Vetterling, W.T.; Flannery, B. P. (1992). <i>Numerical Recipes in Fortran, The Art of Scientific Computing</i> (2nd&nbsp;ed.). Cambridge University Press. p.&nbsp;165.</cite></span>
</li>
<li id="cite_note-10"><span class="mw-cite-backlink"><b><a href="#cite_ref-10">^</a></b></span> <span class="reference-text"><cite id="CITEREFPressTeukolsky1988" class="citation journal cs1">Press, William H.; Teukolsky, Saul A. (1988). <a rel="nofollow" class="external text" href="https://doi.org/10.1063%2F1.4822777">"Evaluating Continued Fractions and Computing Exponential Integrals"</a>. <i>Computers in Physics</i>. <b>2</b> (5): 88. <a href="Bibcode_(identifier)" class="mw-redirect" title="Bibcode (identifier)">Bibcode</a>:<a rel="nofollow" class="external text" href="https://ui.adsabs.harvard.edu/abs/1988ComPh...2...88P">1988ComPh...2...88P</a>. <a href="Doi_(identifier)" class="mw-redirect" title="Doi (identifier)">doi</a>:<span class="id-lock-free" title="Freely accessible"><a rel="nofollow" class="external text" href="https://doi.org/10.1063%2F1.4822777">10.1063/1.4822777</a></span>. <a href="ISSN_(identifier)" class="mw-redirect" title="ISSN (identifier)">ISSN</a>&nbsp;<a rel="nofollow" class="external text" href="https://search.worldcat.org/issn/0894-1866">0894-1866</a>.</cite></span>
</li>
<li id="cite_note-11"><span class="mw-cite-backlink"><b><a href="#cite_ref-11">^</a></b></span> <span class="reference-text"><cite id="CITEREFWandOrmerod2012" class="citation journal cs1">Wand, Matt P.; Ormerod, John T. (2012-09-18). <span class="id-lock-subscription" title="Paid subscription required"><a rel="nofollow" class="external text" href="https://dx.doi.org/10.1002/sta4.4">"Continued fraction enhancement of Bayesian computing"</a></span>. <i>Stat</i>. <b>1</b> (1): <span class="nowrap">31–</span>41. <a href="Doi_(identifier)" class="mw-redirect" title="Doi (identifier)">doi</a>:<a rel="nofollow" class="external text" href="https://doi.org/10.1002%2Fsta4.4">10.1002/sta4.4</a>. <a href="ISSN_(identifier)" class="mw-redirect" title="ISSN (identifier)">ISSN</a>&nbsp;<a rel="nofollow" class="external text" href="https://search.worldcat.org/issn/2049-1573">2049-1573</a>. <a href="PMID_(identifier)" class="mw-redirect" title="PMID (identifier)">PMID</a>&nbsp;<a rel="nofollow" class="external text" href="https://pubmed.ncbi.nlm.nih.gov/22533111">22533111</a>. <a href="S2CID_(identifier)" class="mw-redirect" title="S2CID (identifier)">S2CID</a>&nbsp;<a rel="nofollow" class="external text" href="https://api.semanticscholar.org/CorpusID:119636237">119636237</a>.</cite></span>
</li>
</ol></div></div></div><!--htdig_noindex--><div><div class="zim-footer">
This article is issued from <a class="external text" title="Last edited on 2025-07-31" href="https://en.wikipedia.org/wiki/?title=Lentz's_algorithm&amp;oldid=1303563627">Wikipedia</a>. The text is available under <a class="external text" href="https://creativecommons.org/licenses/by-sa/4.0/deed.en">Creative Commons Attribution-Share Alike 4.0</a> unless otherwise noted. Additional terms may apply for the media files.
</div>
</div><!--/htdig_noindex--></div>
</div>
</main>
</div>
</div>
</div>

</body></html>